using UnityEngine;
using System.Collections;

public class EnemyBehavior : MonoBehaviour
{
//	bool firstUpdate;


	// Use this for initialization
	void Start()
	{
//		firstUpdate = true;

//		gameObject.transform.localScale = gameObject.transform.localScale*0.5f;
//		Debug.Log( "Scale at Start(): " + gameObject.transform.localScale.ToString() );

		OTAnimatingSprite ost = GetComponent<OTAnimatingSprite>();
		ost.size = ost.size*0.5f;

		Vector3 startPosition = new Vector3( 0, 600, -20 );
		ost.position = new Vector2( startPosition.x, startPosition.y );
		gameObject.transform.position = new Vector3( ost.position.x, ost.position.y, -20 );
	}

	// Update is called once per frame
	void Update()
	{
		OTAnimatingSprite ost = GetComponent<OTAnimatingSprite>();

//		if( firstUpdate )
//		{
//			Debug.Log( "Scale at firstUpdate begin(): " + gameObject.transform.localScale.ToString() );
//			ost.size = ost.size*0.5f;
//		}

		Vector3 nextPosition = gameObject.transform.position + new Vector3( 0, -20*Time.deltaTime, -20 );
		ost.position = new Vector2( nextPosition.x, nextPosition.y );
		gameObject.transform.position = new Vector3( ost.position.x, ost.position.y, -20 );

//		if( firstUpdate )
//		{
//			Debug.Log( "Scale at firstUpdate end(): " + gameObject.transform.localScale.ToString() );
//
//			firstUpdate = false;
//		}
	}
}
